Skip to main content
Version: v1

Using your API token

When you sign-up for a browserless account, we create a unique token that allows you to interact with the service. Once your worker(s) are ready you should use this token anytime you interact with the service.

You can use this token with most of our integrations by simply appending a ?token=YOUR-API-TOKEN as a query-string parameter. The only exception is the webdriver integration as most libraries strip query-parameters for remote servers. For webdriver connections, use the format https://YOUR-API-TOKEN@chrome.browserless.io/webdriver.

For the purposes of illustrating these examples, we'll assume your API-TOKEN is 094632bb-e326-4c63-b953-82b55700b14c.

Example integrations

Puppeteer with your API Token

const browser = puppeteer.connect({
browserWSEndpoint: 'wss://chrome.browserless.io?token=094632bb-e326-4c63-b953-82b55700b14c',
});

REST with your API Token

curl -X POST \
https://chrome.browserless.io/content?token=094632bb-e326-4c63-b953-82b55700b14c \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-d '
{
"url": "https://example.com/"
}'

You can also add an Authorization header for REST API requests as well. You'll need to base64 encode this token, and pre-pend the Basic keyword. Read more about Basic authentication here.

curl -X POST \
https://chrome.browserless.io/content \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic MDk0NjMyYmItZTMyNi00YzYzLWI5NTMtODJiNTU3MDBiMTRj' \
-d '
{
"url": "https://example.com/"
}'

Webdriver with your API Token

warning

Webdriver and Selenium are deprecated in Browserless V2 and beyond, and will eventually be removed altogether from our cloud.

const chromeCapabilities = webdriver.Capabilities.chrome();
chromeCapabilities.set('browserless:token', '094632bb-e326-4c63-b953-82b55700b14c');
chromeCapabilities.set('goog:chromeOptions', {
args: [
'--disable-background-timer-throttling',
'--disable-backgrounding-occluded-windows',
'--disable-breakpad',
'--disable-component-extensions-with-background-pages',
'--disable-dev-shm-usage',
'--disable-extensions',
'--disable-features=TranslateUI,BlinkGenPropertyTrees',
'--disable-ipc-flooding-protection',
'--disable-renderer-backgrounding',
'--enable-features=NetworkService,NetworkServiceInProcess',
'--force-color-profile=srgb',
'--hide-scrollbars',
'--metrics-recording-only',
'--mute-audio',
'--headless',
'--no-sandbox',
],
});

const driver = new webdriver.Builder()
.forBrowser('chrome')
.withCapabilities(chromeCapabilities)
.usingServer('https://chrome.browserless.io/webdriver')
.build();